<?php
$pagebg=PAGEBG;
$border=BORDER;
$bghead=BGHEAD;
$bgcat=BGCAT;
$bg1=BG_1;

$_language->read_module('counter');

$date = date("d.m.Y", time());
$dateyesterday = date("d.m.Y", time()-(24*3600));
$datemonth = date(".m.Y", time());

$ergebnis=safe_query("SELECT hits FROM ".PREFIX."counter");
$ds=mysql_fetch_array($ergebnis);
$us = mysql_fetch_array(safe_query("SELECT count(*) FROM ".PREFIX."user"));
$us=$us[0];

$total=$ds['hits'];
$dt = mysql_fetch_array(safe_query("SELECT count FROM ".PREFIX."counter_stats WHERE dates='$date'"));
if($dt['count']) $today = $dt['count'];
else $today = 0;

$dy = mysql_fetch_array(safe_query("SELECT count FROM ".PREFIX."counter_stats WHERE dates='$dateyesterday'"));
if($dy['count']) $yesterday = $dy['count'];
else $yesterday = 0;

$month=0;
$monthquery = safe_query("SELECT count FROM ".PREFIX."counter_stats WHERE dates LIKE '%$datemonth'");
while($dm=mysql_fetch_array($monthquery)) {
	$month = $month+$dm['count'];
}

$guests = mysql_fetch_array(safe_query("SELECT COUNT(*) FROM ".PREFIX."whoisonline WHERE userID=''"));
$user = mysql_fetch_array(safe_query("SELECT COUNT(*) FROM ".PREFIX."whoisonline WHERE ip=''"));
$useronline = $guests[0] + $user[0];

if($user[0]==1) $user_on='1 '.$_language->module['user'];
else $user_on=$user[0].' '.$_language->module['users'];

if($guests[0]==1) $guests_on='1 '.$_language->module['guest'];
else $guests_on= $guests[0].' '.$_language->module['guests'];

eval ("\$stats = \"".gettemplate("stats")."\";");
echo $stats;

?>